package com.ybkj.o2o.zhuanche.common.query;


/**
 * Created by YH on 16/10/28.
 */
public class OrderRefuseQuery {
  
  private Long companyId;
  
  private String appKey;

  private Integer page;

  private Integer rows;

  private Integer offset;
  
  public Long getCompanyId() {
    return companyId;
  }

  public void setCompanyId(Long companyId) {
    this.companyId = companyId;
  }

  public String getAppKey() {
    return appKey;
  }

  public void setAppKey(String appKey) {
    this.appKey = appKey;
  }

  public Integer getPage() {
    return page;
  }

  public void setPage(Integer page) {
    this.page = page;
  }

  public Integer getRows() {
    return rows;
  }

  public void setRows(Integer rows) {
    this.rows = rows;
  }

  /**
   * 根据page和rows计算出偏移量.
   */
  public Integer getOffset() {
    if (getPage() == null || getRows() == null) {
      return null;
    }
    if (getPage() > 0) {
      return (getPage() - 1) * getRows();
    }

    return offset;
  }

  public void setOffset(Integer offset) {
    this.offset = offset;
  }

}
